<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Finding areaDetector Components</title>
  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
</head>
<body>
  <div style="text-align: center">
    <h1>
      Finding areaDetector Components</h1>
    <h2>
      August 9, 2011</h2>
    <h2>
      John Hammonds</h2>
    <h2>
      Argonne National Laboratory</h2>
  </div>
  <h2>
    Overview</h2>
  <p>
    Since areaDetector is composed mostly of plugin components that can be rearranged
    in a number of different ways it can be difficult for a generic client application
    to know everything there is to know about the system ahead of time. It is even difficult
    to know ahead of time what components are installed on a particular IOC. A simple
    method has been developed that will allow the user to find the prefix of the EPICS
    records for all areaDetector compinents.
  </p>
  <p>
    Typically each component (detectors and plugins) loads a series of database templates
    that are provided with areaDetector. Among these templates one will normally load
    ADBase.template for the detectors and NDPluginBase.template for plugins. Each of
    these databases loads an asyn record that allows the user to interact with the asyn
    nature of the plugin. This is generally used for changing the IP address of network
    based cameras or changing debug levels used to print information messages to the
    console. An info field has been added to these records to allow distinguishing it
    from other asyn records. ADBase.template, for instance, defines
  </p>
  <pre>
# Set ASYN_TRACEIO_HEX bit by default
record(asyn,"$(P)$(R)AsynIO")
{
	field(PORT, $(PORT))
	field(TIB2,"1")
	info("ADType", "ADDriver")
}</pre>
  <p>
    The info field ADType can be used to parse the EPICS database and find the asyn
    records that are associated with area detector.
  </p>
  <h2>
    Use</h2>
  <p>
    An iocsh function parseAreaPrefixes has been added to areaDetector (located in ADApp/ADSrc)
    that parses through the EPICS database on a running IOC. This function identifies
    all of the asyn records that contain the ADType info field, parses the record name
    down to the channel prefix (removes AsynIO from the record above) and concatenates
    these prefixes into a space separated list which is then written to a waveform record.
    The name of the waveform record is supplied as an argument to the function.
  </p>
  <p>
    To add this feature to a running IOC all that is necessary is to load a waveform
    record before iocInit and then run parseAreaPrefixes after iocInit. A database template
    with a waveform record is included with areaDetector.</p>
  <p>
    An example of this is shown below. Before iocInit run:
  </p>
  <blockquote>
    <pre>
# Load AreaPrefix record
dbLoadRecords("$(AREA_DETECTOR)/ADApp/Db/ADPrefixes.template", "P=$(PREFIX),R=AD:,NELEMENTS=1024")</pre>
  </blockquote>
  <p>
    After iocInit run</p>
  <blockquote>
    <pre>parseAreaPrefixes("simTest:AD:ChannelPrefixes.VAL")</pre>
  </blockquote>
  <p>
    After this the command caget on a client will yield</p>
  <blockquote>
    <pre>hammonds@jphlaptop ~/epics/base-3.14.10/bin/cygwin-x86
$ ./caget simTest:AD:ChannelPrefixes
simTest:AD:ChannelPrefixes 1024 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 67 'C' 67 'C' 49 '1' 58 ':' 32 ' ' 115
 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 67 'C' 67 'C' 50 '2' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e'
 115 's' 116 't' 58 ':' 74 'J' 80 'P' 69 'E' 71 'G' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 '
:' 78 'N' 101 'e' 120 'x' 117 'u' 115 's' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 80 'P'
114 'r' 111 'o' 99 'c' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 82 'R' 79 'O' 73 'I' 49 '1
' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 82 'R' 79 'O' 73 'I' 50 '2' 58 ':' 32 ' ' 115 's' 105
'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 82 'R' 79 'O' 73 'I' 51 '3' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 1
15 's' 116 't' 58 ':' 82 'R' 79 'O' 73 'I' 52 '4' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 83 'S'
 116 't' 97 'a' 116 't' 115 's' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 83 'S' 116 't' 97
 'a' 116 't' 115 's' 50 '2' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 83 'S' 116 't' 97 'a' 116 't
' 115 's' 51 '3' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 83 'S' 116 't' 97 'a' 116 't' 115 's' 5
2 '4' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 83 'S' 116 't' 97 'a' 116 't' 115 's' 53 '5' 58 ':
' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 84 'T' 73 'I' 70 'F' 70 'F' 49 '1' 58 ':' 32 ' ' 115 's' 105
'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':' 84 'T' 114 'r' 97 'a' 110 'n' 115 's' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm'
 84 'T' 101 'e' 115 's' 116 't' 58 ':' 99 'c' 97 'a' 109 'm' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116
 't' 58 ':' 105 'i' 109 'm' 97 'a' 103 'g' 101 'e' 49 '1' 58 ':' 32 ' ' 115 's' 105 'i' 109 'm' 84 'T' 101 'e' 115 's' 116 't' 58 ':
' 110 'n' 101 'e' 116 't' 67 'C' 68 'D' 70 'F' 49 '1' 58 ':' 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0	</pre>
  </blockquote>
  <p>
    since this is a waveform of char values this is equivalent to the string
  </p>
  <blockquote>
    <pre>simTest:CC1: simTest:CC2: simTest:JPEG1: simTest:Nexus1: simTest:Proc1: simTest:ROI1: simTest:ROI2: simTest:ROI3: simTest:ROI4: simTest:Stats1: simTest:Stats2: simTest:Stats3: simTest:Stats4: simTest:Stats5: simTest:TIFF1: simTest:Trans1: simTest:cam1: simTest:image1: simTest:netCDF1: </pre>
  </blockquote>
  <p>
    Knowing a little about the conventions used in the system, we now know that there
    are:</p>
  <ul>
    <li>Two Color Convert Plugins</li>
    <li>One JPEG File Plugin</li>
    <li>One Nexus File Plugin</li>
    <li>One Processing Plugin</li>
    <li>Four ROI Plugins</li>
    <li>Five Statistics Plugins</li>
    <li>One TIFF File Plugin</li>
    <li>One Transform Plugin</li>
    <li>One Camera (no info on what kind from this)</li>
    <li>One Image Plugin</li>
    <li>One netCDF File Plugin</li>
  </ul>
  <p>
    Armed with this information, a client application can now construct an interface
    to deal with these components.</p>
</body>
</html>
